﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using eCitizen.eAlerts.Utilities;
using eCitizen.DataContracts;

namespace eCitizen.eAlerts.BusinessService
{
    public class HouseKeepingService : ServiceBase,IServiceBase
    {
        public void RunService()
        {
            
            SftpConnectionManager connectionManager = new SftpConnectionManager();
            FileManager requestFileManager = new FileManager();

            CurrentServiceHelper.StartBatchJobWatch(ServiceType.HousekeepingService);

            foreach (SftpConfiguration config in requestFileManager.SftpConfigurations)
            {
                CurrentConfiguration = config;

                //Start logging for the current configuration
                CurrentServiceHelper.StartServiceInstanceWatch(CurrentConfiguration.Agency,CurrentConfiguration.Agency);

                connectionManager.CleanupFilesFromServer(config);

                //End logging for the current configuration
                CurrentServiceHelper.StopServiceInstanceWatch();
            }

            // End of the SendAlertService
            CurrentServiceHelper.StopBatchJobWatch();
            // End of the SendAlertService
        }
    }
}
